version 14.0
log using "\Users\sgolder\Dropbox\Portfolio Allocation\replication\almeida.log", replace
set more off
#delimit ;

*     ***************************************************************** *;
*     ***************************************************************** *;
*       File-Name:      almeida_data.do                                 *;
*       Date:           August 28, 2016                                 *;
*       Author:         Molly Ariotti and Sona Golder                   *;
*       Purpose:      	Create and label some variables.                *;
* 	    Input File:     almeida_cabinets.dta                            *;
*       Output File:    almeida.log                                     *;
*       Data Output:    America.dta                                     *;             
*       Previous file:  almeida_cabinets.xls --> Stata .dta             *;
*       Machine:        laptop                           				*;
*     ****************************************************************  *;
*     ****************************************************************  *;

*     ****************************************************************  *;
*       Open and summarize dataset. Generate some variables             *;
*     ****************************************************************  *;

use "C:\Users\sgolder\Dropbox\Portfolio Allocation\replication\almeida_cabinets.dta";

sum;

drop cabinetname total_govt_portfolios;
rename total_partisan_portfolios government_portfolios;

encode partyname, generate(party);
drop partyname;

gen code = (region*100000) + (countrycode*1000) + cabinetcode ;

*     ****************************************************************  *;
*       Label variables                                                 *;
*     ****************************************************************  *;

label var countryname "country name";
label var party_seats "number of legislative seats per party";
label var party "party number or acronym";
label var region "1=Africa, 2=Western Europe, 3=Latin America";
label var cabinetcode "cabinet code";
label var countrycode "country code";
label var code "region, country code, cabinet code";
label var cowcode "cow code";
label var portfolios "number of portfolios per party";
label var formateur "1 = formateur, 0 = otherwise";
label var presidential "1 = presidential, 0 = parliamentary"; 
label var government_portfolios "number of portfolios in the government";
label var government_seats "number of seats controlled by government";
label var seatshare "party share of leg seats controlled by govt";
label var portfolioshare "party share of govt portfolios";
label var year "year in which government begins";

sum;

desc;

save "C:\Users\sgolder\Dropbox\Portfolio Allocation\replication\America.dta", replace;

log close;
exit;
